package com.tedu.mybatis.mapper;

import com.tedu.mybatis.pojo.*;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface WeiboMapper {
    /*@Insert("INSERT INTO weibo(content,created,user_id) " +
            "VALUES(#{content},#{created},#{user_id}) ")*/
    int insert(Weibo weibo);

    /*@Delete("DELETE FROM weibo WHERE id=#{id}")*/
    int deleteById(Integer id);

    /*@Update("UPDATE weibo " +
            "SET content=#{content},created=#{created},user_id=#{user_id} " +
            "WHERE id=#{id}")*/
    int update(Weibo weibo);

    /*@Select("SELECT id,content,created,user_id " +
            "FROM weibo " +
            "WHERE id = #{id}")*/
    Weibo select(Integer id);

    /*@Select("SELECT id,content,created,user_id " +
            "FROM weibo ")*/
    List<Weibo> selectAll();

    /*@Select("SELECT content,created FROM weibo WHERE id=#{id}")*/
    WeiboVO1 selectWeiboVO1ById(Integer id);

    /*@Select("SELECT id,content FROM weibo ")*/
    List<WeiboVO2> selectWeiboVO2ById();

    int dynamicUpdateById(Weibo weibo);

    int dynamicDeleteById(Integer[] ids);

    int dynamicDeleteById2(List<Integer> list);

    //测试使用映射表奖结果集对应返回
    WeiboVO3 selectResultMap(Integer id);

    WeiboVO4 selectWeiboAndCommentById(Integer id);

    int countWeibo();
}
